package com.xwj.entity;

import com.xwj.Enums.HouseMetaDataEnum;

import java.beans.Transient;
import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 屋子详情
 */
public class HouseInfoDetailEntity implements Serializable {
    private static final long serialVersionUID = -6739149120347347161L;

    private String houseName;//名称

    private String address;//详细地址

    private double price; //价格

    private int type; //类型：整租／合租

    private int houseType; //　户型（一室一厅）

    private int renovation;//　装修

    private Map<String, Object> metaData = new ConcurrentHashMap<>(); //元数据：水电费，ＷｉＦｉ等

    private String txt; //详细文本

    private HouseInfoPhotosEntity photos; //图片

    private String videoUrl; //视频

    public HouseInfoDetailEntity() {
    }

    public String getHouseName() {
        return houseName;
    }

    public void setHouseName(String houseName) {
        this.houseName = houseName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Map<String, Object> getMetaData() {
        return metaData;
    }

    public void setMetaData(Map<String, Object> metaData) {
        this.metaData = metaData;
    }

    public String getTxt() {
        return txt;
    }

    public void setTxt(String txt) {
        this.txt = txt;
    }

    public HouseInfoPhotosEntity getPhotos() {
        return photos;
    }

    public void setPhotos(HouseInfoPhotosEntity photos) {
        this.photos = photos;
    }

    public String getVideoUrl() {
        return videoUrl;
    }

    public void setVideoUrl(String videoUrl) {
        this.videoUrl = videoUrl;
    }

    public int getHouseType() {
        return houseType;
    }

    public void setHouseType(int houseType) {
        this.houseType = houseType;
    }

    public int getRenovation() {
        return renovation;
    }

    public void setRenovation(int renovation) {
        this.renovation = renovation;
    }

    @Transient
    public void setExtralData(String extralData) {
        int index = extralData.lastIndexOf(",");
        metaData.put(HouseMetaDataEnum.AdditionalAttr.getName(), extralData.substring(0, index));
    }

    @Transient
    public void setWaterRate(String waterRate) {
        metaData.put(HouseMetaDataEnum.WaterRate.getName(), waterRate);
    }

    @Transient
    public void setElectricityFee(String electricityFee) {
        metaData.put(HouseMetaDataEnum.ElectricityFee.getName(), electricityFee);
    }

    @Transient
    public void setExtralFee(String extralFee) {
        metaData.put(HouseMetaDataEnum.ExtralFee.getName(), extralFee);
    }


}
